package com.czhappy.huans.service.impl;

import com.czhappy.huans.dao.KaoqinDao;
import com.czhappy.huans.dao.UserDao;
import com.czhappy.huans.entity.Area;
import com.czhappy.huans.entity.Kaoqin;
import com.czhappy.huans.entity.User;
import com.czhappy.huans.service.KaoqinService;
import com.czhappy.huans.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;


@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserDao userDao;

	@Override
	public List<User> queryUserList() {
		return userDao.queryUserList();
	}

	@Transactional
	@Override
	public boolean addUser(User user) {
		try {
			int effectedNum = userDao.insertUser(user);
			if (effectedNum > 0) {
				return true;
			} else {
				throw new RuntimeException("添加用户信息失败!");
			}
		} catch (Exception e) {
			throw new RuntimeException("添加用户信息失败:" + e.toString());
		}
	}
}
